var $toast = $('<div class="toast hide"></div>').appendTo(document.body);

var Toast = {
  show: function (txt) {
    $toast.html(txt);
    $toast.removeClass('hide');
  },

  hide: function () {
    $toast.addClass('hide');
  },

  toggle: function (txt, time, callback) {
    $toast.html(txt).removeClass('hide');

    if (time!==0) {
      setTimeout(function () {
        $toast.addClass('hide');

        callback && callback();
      }, time || 1500);      
    }
  }
};

define(function (require, exports, module) {
  module.exports = Toast;
  });
